var form;
var table;
layui.use(['form','table'],function(){
    form = layui.form;
    table=layui.table;
});

//课程分类下拉菜单
$.ajax({
    url: "/SyOperationController/selCourseClassSelect",
    type: "get",
    dataType: "json",
    success: function (data) {
        for(var a=0;a<data.obj.length;a++){
            $("#name").append("<option value='"+data.obj[a].id+"'>"+data.obj[a].name+"</option>");
        }
    }
});

//取消
function cancel(){
    var layer_1=parent.layer_1;
    layer_1.close(layer_1.index);
};

//确定修改
function updateCourse(){

    var courseNo=$('input[name=courseNo]').val();
    var courseName=$('input[name=courseName]').val();
    var courseNprice=$('input[name=courseNprice]').val();
    var classId=$('#name').val();
    var saleNum=$('input[name=saleNum]').val();
    var courseLabel=$('#courseLabel').val();
    var courseIntro=$('#courseIntro').val();
    var courseId=$("#courseId").val();
    var coursePrice=$("#coursePrice").val();



    $.ajax({
        url: "/SyOperationController/updCourses",
        type: "post",
        dataType: "json",
        data:{"courseNo":courseNo,"courseName":courseName,"courseNprice":courseNprice,"classId":classId,"saleNum":saleNum,"courseLabel":courseLabel,"courseIntro":courseIntro,"courseId":courseId,"coursePrice":coursePrice},
        success: function (data) {
            if(data.code==0){
                var layer_1=parent.layer_1;
                layer_1.close(layer_1.index);
                parent.selCourses();
            }else{
                console.log("修改失败")
            }
        }
    });
}
